//
//  ViewController.m
//  RSUIScrollView
//
//  Created by thinkjoy on 16/8/26.
//  Copyright © 2016年 Thinkjoy_RS. All rights reserved.
//

#import "ViewController.h"
#import "RSImgVScrollView.h"
#import "TableViewController.h"

#import "KIImagePager.h"
@interface ViewController ()<RSImgVScrollViewDataSource,KIImagePagerDataSource,RSImgVScrollViewDelegate>

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    RSImgVScrollView    * imgVScroller  =   [[RSImgVScrollView alloc]initWithFrame:CGRectMake(10, 10, 300, 200)];
    imgVScroller.dataSource =   self;
    imgVScroller.delegate   =   self;
    [self.view   addSubview:imgVScroller];
//    [imgVScroller setPageControllPosition:RSImgVScrollViewPageControllPositionHidden];
//    imgVScroller.bounces =   NO;
//    imgVScroller.showPageControl    =   NO;
    imgVScroller.intervalTime   =   3;
//    imgVScroller.scrollEnabledForSinglePages    =   YES;
    imgVScroller.scrollType     =   RSImgVScrollViewRollingTypeSingleLoop;
    [imgVScroller setpageControlCurrentColor:[UIColor redColor] OtherColor:[UIColor grayColor]];
    
    
    KIImagePager    * imagePager    =   [[KIImagePager alloc]initWithFrame:CGRectMake(10, 230, 300, 200)];
    imagePager.dataSource   =   self;
    [self.view   addSubview:imagePager];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (NSArray *)arrayWithImages
{
    return @[@"http://h.hiphotos.baidu.com/zhidao/wh%3D450%2C600/sign=c56b791f19d5ad6eaaac6ceeb4fb15ed/cf1b9d16fdfaaf51e4aec3648e5494eef11f7a9f.jpg",@"http://www.wndhw.com/renti/oumei/images/om275.jpg",@"http://ww1.sinaimg.cn/mw600/85d79bcbjw1erlanf9f6hj20go0p0goe.jpg"];
}

- (UIViewContentMode)contentModeForImage:(NSUInteger)index
{
    return UIViewContentModeScaleAspectFit;
}

- (NSArray *)arrayWithImagesInImgVScrollView:(RSImgVScrollView *)imgVScrollView
{
//    return nil;
//    return @[[NSURL URLWithString:@"http://h.hiphotos.baidu.com/zhidao/wh%3D450%2C600/sign=c56b791f19d5ad6eaaac6ceeb4fb15ed/cf1b9d16fdfaaf51e4aec3648e5494eef11f7a9f.jpg"]];
    return @[[NSURL URLWithString:@"http://h.hiphotos.baidu.com/zhidao/wh%3D450%2C600/sign=c56b791f19d5ad6eaaac6ceeb4fb15ed/cf1b9d16fdfaaf51e4aec3648e5494eef11f7a9f.jpg"],[NSURL URLWithString:@"http://www.wndhw.com/renti/oumei/images/om275.jpg"],[NSURL URLWithString:@"http://ww1.sinaimg.cn/mw600/85d79bcbjw1erlanf9f6hj20go0p0goe.jpg"],[NSURL URLWithString:@"http://t2.fansimg.com/uploads2012/03/userid354497time20120325135800at42.jpg"]];
//    return @[@"http://h.hiphotos.baidu.com/zhidao/wh%3D450%2C600/sign=c56b791f19d5ad6eaaac6ceeb4fb15ed/cf1b9d16fdfaaf51e4aec3648e5494eef11f7a9f.jpg",@"http://www.wndhw.com/renti/oumei/images/om275.jpg",@"http://ww1.sinaimg.cn/mw600/85d79bcbjw1erlanf9f6hj20go0p0goe.jpg"];
}

- (UIImage *)placeHolderImageForImgVScrollView
{
    return [UIImage imageNamed:@"KICamera"];
}
- (UIViewContentMode)placeHolderImageVContentModeForImgVScrollView
{
    return UIViewContentModeScaleAspectFit;
}
- (UIViewContentMode)imgVScrollView:(RSImgVScrollView *)imgVScrollView contentModeForImgAtIndex:(NSInteger)index
{
    return UIViewContentModeScaleAspectFit;
}

- (void)imgVScrollView:(RSImgVScrollView *)imgVScrollView didSelectImageAtIndex:(NSUInteger)index
{
    NSLog(@"点击了%d",index);
}

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
    
    TableViewController * TV    =   [[TableViewController alloc]init];
    [self.navigationController   pushViewController:TV animated:YES];
    
}
@end
